//
//  OSTools.h
//  Stock_Pro
//
//  Created by CH on 11-2-14.
//  Copyright 2011 gaotime. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UITextField.h>
#import <CoreGraphics/CGGeometry.h>
#import "Tools.h"


//UIImage* LoadImage(NSString *path);
//#define img_loaded(s) ImageTools_GetImageLinkNode
//#define OSImage(s) [[UIImage imageNamed:s] retain]//[[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:s ofType:@"png"]] retain]

//#define OSImage(s) [[UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] bundlePath], s]] retain]

#define OSImage(s)  [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@", [[NSBundle mainBundle] bundlePath], s]]


@interface OSTools : NSObject {
  
}

+(void) TextFieldChangeText:(UITextField *) textField withLimit:(int) aLen;

+(CGSize) AppSize;

/**
 *  @brief     计算高度
 *
 *
 *	@return
 *  @note
 */
+(int) calcHeight:(CGFloat)aModu;

/**
 *  @brief     计算宽度
 *
 *
 *	@return
 *  @note
 */
+(int) calcWidth:(CGFloat)aModu;

/**
 *  @brief     大字体
 *
 *
 *	@return     25
 *  @note
 */
+(int) BigFontHeight;

/**
 *  @brief     中字体
 *
 *
 *	@return     19
 *  @note
 */
+(int) MidFontHeight;

/**
 *  @brief     小字体
 *
 *
 *	@return     14
 *  @note
 */
+(int)SmallFontHeight;

/**
 *  @brief     最小字体
 *
 *
 *	@return     12
 *  @note
 */
+(int)LeastFontHeight;

/**
 *  @brief     计算字符串绘制所需的尺寸
 *
 *  @param[in]		NSString          *aStr            字符串
 *  @param[in]		int               aSize            字体大小
 *  @param[in]		int               aWidth           宽度（－1：表示一行）
 *
 *	@return     12
 *  @note
 */
+(CGSize) calcStringSize:(NSString*)aStr withFontSize:(UIFont*)font withWidth:(int)aWidth;

/**
 *  @brief     模拟windows下 GetTickCount
 *
 *
 *	@return
 *  @note
 */
+(int) mxGetTickCount;

+(float)heightForString:(NSString *)value fontSize:(float)fontSize andWidth:(float)width;

//1、下载zip资源
+(NSString*)DownloadTextFile:(NSString*)fileUrl fileName:(NSString*)_fileName;

//2.解压zip包
+(void)OpenZip:(NSString*)zipPath  unzipto:(NSString*)_unzipto;

+(BOOL)DownloadAndOpenZip:(NSString*)fileUrl fileName:(NSString*)_fileName unzipto:(NSString*)_unzipto;

+(NSString*) base64Encode:(NSData *)data;
//+(NSString *)tradeRequest_Syn:(NSString *)requestJsonString;
//+(void)tradeRequest_Asy:(NSString *)requestJsonString withRequest:(ASIHTTPRequest **)request;
+(NSMutableString *)createJSONString:(NSMutableArray *)requestArray;
@end
